import Dexie from 'dexie'
import { ICourse } from '../model/ICourse'
import { ISession } from '../model/ISession'
import { IStudent } from '../model/IStudent'
import { ITeacher } from '../model/ITeacher'
export class CMDatabase extends Dexie {
    courses: Dexie.Table<ICourse, number>;
    sessions: Dexie.Table<ISession, number>;
    students: Dexie.Table<IStudent, number>;
    teachers: Dexie.Table<ITeacher, number>;

    constructor (){
        super("CMDatabase")
        this.version(1).stores({
            courses: "++id,name,grade,type",
            sessions: "++id,name,course,student,teacher,time",
            students: "++id,name,gender,schoolName,grade,classNumber",
            teachers: "++id,name,gender,age"
        })
        this.courses=this.table("courses")
        this.sessions=this.table("sessions")
        this.students=this.table("students")
        this.teachers=this.table("teachers")
    }
}